import 'package:local_coffee/components/rgba.dart';
import 'package:flutter/material.dart';
import 'package:local_coffee/utils/global.dart';

class DaQiaSay extends StatelessWidget {
  
  final String avatar;
  final String name;
  final String label;
  final String desc;
  final String time;

  /// 大咖说
  /// ```
  /// @param {String} avatar - 头像
  /// @param {String} name - 名字
  /// @param {String} label - 标签
  /// @param {String} desc - 描述
  /// @param {String} time - 时间
  /// ```
  DaQiaSay({
    this.avatar,
    this.name,
    this.label = '',
    this.desc = '',
    this.time = ''
  }) : assert(
    avatar != null,
    name != null
  );

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.only(left: 15, right: 15),
      margin: EdgeInsets.only(top: 6),
      child: Container(
        padding: EdgeInsets.only(bottom: 8),
        decoration: BoxDecoration(
          border: G.borderBottom()
        ),
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Container(
              width: 30,
              height: 30,
              child: ClipRRect(
                borderRadius: BorderRadius.circular(30),
                child: Image.asset(
                  avatar,
                  width: 30,
                  height: 30,
                  fit: BoxFit.cover,
                ),
              ),
            ),
            Expanded(
              child: Container(
                margin: EdgeInsets.only(top: 10, left: 10),
                child: Column(
                  children: <Widget>[
                    Container(
                      child: Row(
                        crossAxisAlignment: CrossAxisAlignment.center,
                        children: <Widget>[
                          Text(
                            name,
                            style: TextStyle(fontSize: 12),
                          ),
                          Container(
                            padding: EdgeInsets.symmetric(horizontal: 5),
                            decoration: BoxDecoration(
                              borderRadius: BorderRadius.circular(2),
                              color: RGBA.rgbaf2f2f2
                            ),
                            margin: EdgeInsets.only(left: 5),
                            child: Text(
                              label,
                              style: TextStyle(
                                color: RGBA.rgba252cb1
                              ),
                            ),
                          )
                        ],
                      ),
                    ),
                    Container(
                      margin: EdgeInsets.only(top: 5),
                      child: Column(
                        children: <Widget>[
                          Wrap(
                            children: <Widget>[
                              Text(
                                desc,
                                style: TextStyle(
                                  fontSize: 12,
                                  color: RGBA.rgba808080
                                ),
                              )
                            ],
                          )
                        ],
                      ),
                    ),
                    Container(
                      margin: EdgeInsets.only(top: 5),
                      alignment: Alignment.centerLeft,
                      child: Text(
                        time,
                        style: TextStyle(
                          color: RGBA.rgba88afd5,
                          fontSize: 12
                        ),
                      ),
                    )
                  ],
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
}